\(\int \frac {(d+e x)^2 (a+b \log (c x^n))}{x} \, dx\) [13]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [A] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 21, antiderivative size = 80 \[ \int \frac {(d+e x)^2 \left (a+b \log \left (c x^n\right )\right )}{x} \, dx=-\frac {1}{4} b n (4 d+e x)^2-\frac {1}{2} b d^2 n \log ^2(x)+2 d e x \left (a+b \log \left (c x^n\right )\right )+\frac {1}{2} e^2 x^2 \left (a+b \log \left (c x^n\right )\right )+d^2 \log (x) \left (a+b \log \left (c x^n\right )\right ) \]

[Out]

-1/4*b*n*(e*x+4*d)^2-1/2*b*d^2*n*ln(x)^2+2*d*e*x*(a+b*ln(c*x^n))+1/2*e^2*x^2*(a+b*ln(c*x^n))+d^2*ln(x)*(a+b*ln
(c*x^n))

Rubi [A] (verified)

Time = 0.05 (sec) , antiderivative size = 80, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.143, Rules used = {45, 2372, 2338} \[ \int \frac {(d+e x)^2 \left (a+b \log \left (c x^n\right )\right )}{x} \, dx=d^2 \log (x) \left (a+b \log \left (c x^n\right )\right )+2 d e x \left (a+b \log \left (c x^n\right )\right )+\frac {1}{2} e^2 x^2 \left (a+b \log \left (c x^n\right )\right )-\frac {1}{2} b d^2 n \log ^2(x)-\frac {1}{4} b n (4 d+e x)^2 \]

[In]

Int[((d + e*x)^2*(a + b*Log[c*x^n]))/x,x]

[Out]

-1/4*(b*n*(4*d + e*x)^2) - (b*d^2*n*Log[x]^2)/2 + 2*d*e*x*(a + b*Log[c*x^n]) + (e^2*x^2*(a + b*Log[c*x^n]))/2
+ d^2*Log[x]*(a + b*Log[c*x^n])

Rule 45

Int[((a_.) + (b_.)*(x_))^(m_.)*((c_.) + (d_.)*(x_))^(n_.), x_Symbol] :> Int[ExpandIntegrand[(a + b*x)^m*(c + d
*x)^n, x], x] /; FreeQ[{a, b, c, d, n}, x] && NeQ[b*c - a*d, 0] && IGtQ[m, 0] && ( !IntegerQ[n] || (EqQ[c, 0]
&& LeQ[7*m + 4*n + 4, 0]) || LtQ[9*m + 5*(n + 1), 0] || GtQ[m + n + 2, 0])

Rule 2338

Int[((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))/(x_), x_Symbol] :> Simp[(a + b*Log[c*x^n])^2/(2*b*n), x] /; FreeQ[{a
, b, c, n}, x]

Rule 2372

Int[((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))*(x_)^(m_.)*((d_) + (e_.)*(x_)^(r_.))^(q_.), x_Symbol] :> With[{u = I
ntHide[x^m*(d + e*x^r)^q, x]}, Dist[a + b*Log[c*x^n], u, x] - Dist[b*n, Int[SimplifyIntegrand[u/x, x], x], x]]
 /; FreeQ[{a, b, c, d, e, n, r}, x] && IGtQ[q, 0] && IntegerQ[m] &&  !(EqQ[q, 1] && EqQ[m, -1])

Rubi steps \begin{align*} \text {integral}& = 2 d e x \left (a+b \log \left (c x^n\right )\right )+\frac {1}{2} e^2 x^2 \left (a+b \log \left (c x^n\right )\right )+d^2 \log (x) \left (a+b \log \left (c x^n\right )\right )-(b n) \int \left (\frac {1}{2} e (4 d+e x)+\frac {d^2 \log (x)}{x}\right ) \, dx \\ & = -\frac {1}{4} b n (4 d+e x)^2+2 d e x \left (a+b \log \left (c x^n\right )\right )+\frac {1}{2} e^2 x^2 \left (a+b \log \left (c x^n\right )\right )+d^2 \log (x) \left (a+b \log \left (c x^n\right )\right )-\left (b d^2 n\right ) \int \frac {\log (x)}{x} \, dx \\ & = -\frac {1}{4} b n (4 d+e x)^2-\frac {1}{2} b d^2 n \log ^2(x)+2 d e x \left (a+b \log \left (c x^n\right )\right )+\frac {1}{2} e^2 x^2 \left (a+b \log \left (c x^n\right )\right )+d^2 \log (x) \left (a+b \log \left (c x^n\right )\right ) \\ \end{align*}

Mathematica [A] (verified)

Time = 0.04 (sec) , antiderivative size = 83, normalized size of antiderivative = 1.04 \[ \int \frac {(d+e x)^2 \left (a+b \log \left (c x^n\right )\right )}{x} \, dx=2 a d e x-2 b d e n x-\frac {1}{4} b e^2 n x^2+2 b d e x \log \left (c x^n\right )+\frac {1}{2} e^2 x^2 \left (a+b \log \left (c x^n\right )\right )+\frac {d^2 \left (a+b \log \left (c x^n\right )\right )^2}{2 b n} \]

[In]

Integrate[((d + e*x)^2*(a + b*Log[c*x^n]))/x,x]

[Out]

2*a*d*e*x - 2*b*d*e*n*x - (b*e^2*n*x^2)/4 + 2*b*d*e*x*Log[c*x^n] + (e^2*x^2*(a + b*Log[c*x^n]))/2 + (d^2*(a +
b*Log[c*x^n])^2)/(2*b*n)

Maple [A] (verified)

Time = 0.62 (sec) , antiderivative size = 97, normalized size of antiderivative = 1.21

method result size
parallelrisch \(\frac {2 x^{2} \ln \left (c \,x^{n}\right ) b \,e^{2} n -x^{2} b \,e^{2} n^{2}+2 x^{2} a \,e^{2} n +8 x \ln \left (c \,x^{n}\right ) b d e n -8 x b d e \,n^{2}+4 \ln \left (x \right ) a \,d^{2} n +8 x a d e n +2 b \,d^{2} \ln \left (c \,x^{n}\right )^{2}}{4 n}\) \(97\)
risch \(\left (\frac {x^{2} b \,e^{2}}{2}+2 b d e x +b \,d^{2} \ln \left (x \right )\right ) \ln \left (x^{n}\right )-\frac {b \,d^{2} n \ln \left (x \right )^{2}}{2}+\frac {i \ln \left (x \right ) \pi b \,d^{2} \operatorname {csgn}\left (i c \right ) \operatorname {csgn}\left (i c \,x^{n}\right )^{2}}{2}+\frac {i \pi b \,e^{2} x^{2} \operatorname {csgn}\left (i c \right ) \operatorname {csgn}\left (i c \,x^{n}\right )^{2}}{4}-\frac {i \pi b \,e^{2} x^{2} \operatorname {csgn}\left (i c \right ) \operatorname {csgn}\left (i x^{n}\right ) \operatorname {csgn}\left (i c \,x^{n}\right )}{4}-i \pi b d e x \operatorname {csgn}\left (i c \,x^{n}\right )^{3}+i \pi b d e x \,\operatorname {csgn}\left (i x^{n}\right ) \operatorname {csgn}\left (i c \,x^{n}\right )^{2}+\frac {i \pi b \,e^{2} x^{2} \operatorname {csgn}\left (i x^{n}\right ) \operatorname {csgn}\left (i c \,x^{n}\right )^{2}}{4}-\frac {i \ln \left (x \right ) \pi b \,d^{2} \operatorname {csgn}\left (i c \right ) \operatorname {csgn}\left (i x^{n}\right ) \operatorname {csgn}\left (i c \,x^{n}\right )}{2}+\frac {i \ln \left (x \right ) \pi b \,d^{2} \operatorname {csgn}\left (i x^{n}\right ) \operatorname {csgn}\left (i c \,x^{n}\right )^{2}}{2}+\frac {\ln \left (c \right ) b \,e^{2} x^{2}}{2}-\frac {b \,e^{2} n \,x^{2}}{4}+2 \ln \left (c \right ) b d e x +\frac {a \,e^{2} x^{2}}{2}-2 b d e n x +2 a d e x -i \pi b d e x \,\operatorname {csgn}\left (i c \right ) \operatorname {csgn}\left (i x^{n}\right ) \operatorname {csgn}\left (i c \,x^{n}\right )-\frac {i \pi b \,e^{2} x^{2} \operatorname {csgn}\left (i c \,x^{n}\right )^{3}}{4}-\frac {i \ln \left (x \right ) \pi b \,d^{2} \operatorname {csgn}\left (i c \,x^{n}\right )^{3}}{2}+i \pi b d e x \,\operatorname {csgn}\left (i c \right ) \operatorname {csgn}\left (i c \,x^{n}\right )^{2}+\ln \left (x \right ) \ln \left (c \right ) b \,d^{2}+\ln \left (x \right ) a \,d^{2}\) \(410\)

[In]

int((e*x+d)^2*(a+b*ln(c*x^n))/x,x,method=_RETURNVERBOSE)

[Out]

1/4*(2*x^2*ln(c*x^n)*b*e^2*n-x^2*b*e^2*n^2+2*x^2*a*e^2*n+8*x*ln(c*x^n)*b*d*e*n-8*x*b*d*e*n^2+4*ln(x)*a*d^2*n+8
*x*a*d*e*n+2*b*d^2*ln(c*x^n)^2)/n

Fricas [A] (verification not implemented)

none

Time = 0.30 (sec) , antiderivative size = 98, normalized size of antiderivative = 1.22 \[ \int \frac {(d+e x)^2 \left (a+b \log \left (c x^n\right )\right )}{x} \, dx=\frac {1}{2} \, b d^{2} n \log \left (x\right )^{2} - \frac {1}{4} \, {\left (b e^{2} n - 2 \, a e^{2}\right )} x^{2} - 2 \, {\left (b d e n - a d e\right )} x + \frac {1}{2} \, {\left (b e^{2} x^{2} + 4 \, b d e x\right )} \log \left (c\right ) + \frac {1}{2} \, {\left (b e^{2} n x^{2} + 4 \, b d e n x + 2 \, b d^{2} \log \left (c\right ) + 2 \, a d^{2}\right )} \log \left (x\right ) \]

[In]

integrate((e*x+d)^2*(a+b*log(c*x^n))/x,x, algorithm="fricas")

[Out]

1/2*b*d^2*n*log(x)^2 - 1/4*(b*e^2*n - 2*a*e^2)*x^2 - 2*(b*d*e*n - a*d*e)*x + 1/2*(b*e^2*x^2 + 4*b*d*e*x)*log(c
) + 1/2*(b*e^2*n*x^2 + 4*b*d*e*n*x + 2*b*d^2*log(c) + 2*a*d^2)*log(x)

Sympy [A] (verification not implemented)

Time = 0.25 (sec) , antiderivative size = 131, normalized size of antiderivative = 1.64 \[ \int \frac {(d+e x)^2 \left (a+b \log \left (c x^n\right )\right )}{x} \, dx=\begin {cases} \frac {a d^{2} \log {\left (c x^{n} \right )}}{n} + 2 a d e x + \frac {a e^{2} x^{2}}{2} + \frac {b d^{2} \log {\left (c x^{n} \right )}^{2}}{2 n} - 2 b d e n x + 2 b d e x \log {\left (c x^{n} \right )} - \frac {b e^{2} n x^{2}}{4} + \frac {b e^{2} x^{2} \log {\left (c x^{n} \right )}}{2} & \text {for}\: n \neq 0 \\\left (a + b \log {\left (c \right )}\right ) \left (d^{2} \log {\left (x \right )} + 2 d e x + \frac {e^{2} x^{2}}{2}\right ) & \text {otherwise} \end {cases} \]

[In]

integrate((e*x+d)**2*(a+b*ln(c*x**n))/x,x)

[Out]

Piecewise((a*d**2*log(c*x**n)/n + 2*a*d*e*x + a*e**2*x**2/2 + b*d**2*log(c*x**n)**2/(2*n) - 2*b*d*e*n*x + 2*b*
d*e*x*log(c*x**n) - b*e**2*n*x**2/4 + b*e**2*x**2*log(c*x**n)/2, Ne(n, 0)), ((a + b*log(c))*(d**2*log(x) + 2*d
*e*x + e**2*x**2/2), True))

Maxima [A] (verification not implemented)

none

Time = 0.19 (sec) , antiderivative size = 84, normalized size of antiderivative = 1.05 \[ \int \frac {(d+e x)^2 \left (a+b \log \left (c x^n\right )\right )}{x} \, dx=-\frac {1}{4} \, b e^{2} n x^{2} + \frac {1}{2} \, b e^{2} x^{2} \log \left (c x^{n}\right ) - 2 \, b d e n x + \frac {1}{2} \, a e^{2} x^{2} + 2 \, b d e x \log \left (c x^{n}\right ) + 2 \, a d e x + \frac {b d^{2} \log \left (c x^{n}\right )^{2}}{2 \, n} + a d^{2} \log \left (x\right ) \]

[In]

integrate((e*x+d)^2*(a+b*log(c*x^n))/x,x, algorithm="maxima")

[Out]

-1/4*b*e^2*n*x^2 + 1/2*b*e^2*x^2*log(c*x^n) - 2*b*d*e*n*x + 1/2*a*e^2*x^2 + 2*b*d*e*x*log(c*x^n) + 2*a*d*e*x +
 1/2*b*d^2*log(c*x^n)^2/n + a*d^2*log(x)

Giac [A] (verification not implemented)

none

Time = 0.34 (sec) , antiderivative size = 96, normalized size of antiderivative = 1.20 \[ \int \frac {(d+e x)^2 \left (a+b \log \left (c x^n\right )\right )}{x} \, dx=\frac {1}{2} \, b d^{2} n \log \left (x\right )^{2} - \frac {1}{4} \, {\left (b e^{2} n - 2 \, b e^{2} \log \left (c\right ) - 2 \, a e^{2}\right )} x^{2} - 2 \, {\left (b d e n - b d e \log \left (c\right ) - a d e\right )} x + \frac {1}{2} \, {\left (b e^{2} n x^{2} + 4 \, b d e n x\right )} \log \left (x\right ) + {\left (b d^{2} \log \left (c\right ) + a d^{2}\right )} \log \left (x\right ) \]

[In]

integrate((e*x+d)^2*(a+b*log(c*x^n))/x,x, algorithm="giac")

[Out]

1/2*b*d^2*n*log(x)^2 - 1/4*(b*e^2*n - 2*b*e^2*log(c) - 2*a*e^2)*x^2 - 2*(b*d*e*n - b*d*e*log(c) - a*d*e)*x + 1
/2*(b*e^2*n*x^2 + 4*b*d*e*n*x)*log(x) + (b*d^2*log(c) + a*d^2)*log(x)

Mupad [B] (verification not implemented)

Time = 0.34 (sec) , antiderivative size = 75, normalized size of antiderivative = 0.94 \[ \int \frac {(d+e x)^2 \left (a+b \log \left (c x^n\right )\right )}{x} \, dx=\ln \left (c\,x^n\right )\,\left (\frac {b\,e^2\,x^2}{2}+2\,b\,d\,e\,x\right )+\frac {e^2\,x^2\,\left (2\,a-b\,n\right )}{4}+a\,d^2\,\ln \left (x\right )+\frac {b\,d^2\,{\ln \left (c\,x^n\right )}^2}{2\,n}+2\,d\,e\,x\,\left (a-b\,n\right ) \]

[In]

int(((a + b*log(c*x^n))*(d + e*x)^2)/x,x)

[Out]

log(c*x^n)*((b*e^2*x^2)/2 + 2*b*d*e*x) + (e^2*x^2*(2*a - b*n))/4 + a*d^2*log(x) + (b*d^2*log(c*x^n)^2)/(2*n) +
 2*d*e*x*(a - b*n)